﻿/**
 *
 * @file FITKAbaMeshPartVTK.h
 * @brief vtk表示的非结构网格
 * @author LiBaojun (libaojunqd@foxmail.com)
 * @date 2024-03-30
 *
 */
#ifndef _FITKABAMESHPARTVTK_H__
#define _FITKABAMESHPARTVTK_H__

#include "FITKInterfaceStructuralAPI.h"
#include "FITKAbaSurfaceLabel.h"
#include "FITK_Interface/FITKInterfaceMesh/FITKUnstructuredMeshVTK.h"

namespace Interface
{
    struct AbaEleSurface
    {
        //类型与vtkCellType一致
        int _faceType{ -1 };
        //全局节点ID
        QList<int> _nodeIDs{};
    };

    class FITKInterfaceStructuralAPI FITKAbaMeshPartVTK
        : public Interface::FITKUnstructuredMeshVTK
    {
        Q_OBJECT
    public:
        /**
         * @brief Abaqus单元类型
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-03-30
         */
        enum AbaEleType
        {
            AbaEleNone = 0,
            B31,
            B32,
            T3D2,
            T3D3,
            S3,
            CPS3,
            S4,
            S4R,
            S8,
            C3D4,
            C3D6,
            C3D8,
            C3D8I,
            C3D8R,
            C3D10,
            C3D10M,
            C3D20,
            R3D4,
        };
        Q_ENUM(AbaEleType);

        using Interface::FITKUnstructuredMeshVTK::FITKUnstructuredMeshVTK;
       /**
        * @brief Destroy the FITKAbaMeshPartVTK object
        * @author LiBaojun (libaojunqd@foxmail.com)
        * @date 2024-03-30
        */
        virtual ~FITKAbaMeshPartVTK();
        /**
         * @brief 追加单元
         * @param[i]  eleType        单元类型
         * @param[i]  eleID          单元ID
         * @param[i]  nodeIDList     节点ID列表
         * @return  是否追加成功
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-03-30
         */
        bool appendElement(AbaEleType eleType, const int eleID, const QList<int>& nodeIDList);
        /**
         * @brief 获取单元类型
         * @param[i]  index          第index个单元
         * @return AbaEleType
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-03-30
         */
        AbaEleType getAbaElementType(const int index) const;

        /**
         * @brief 获取单元类型
         * @param[i]  eleid           单元id
         * @return AbaEleType
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-04-23
         */
        AbaEleType getAbaElementTypeByID(const int eleid) const;
        /**
         * @brief  获取表面信息
         * @param[i]  cellid         单元ID
         * @param[i]  label          表面标记
         * @return AbaEleSurface
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-04-11
         */
        AbaEleSurface getEleFace(const int cellid, FITKAbaSurfaceLabel::AbaSurfLabel label);

    private:
        /**
         * @brief Create a Element object
         * @param[i]  abaEleType     单元类型
         * @return FITKAbstractElement*
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-03-30
         */
        FITKAbstractElement* createElement(AbaEleType abaEleType);
    private:
        /**
         * @brief 单元类型列表
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-03-30
         */
        QList<AbaEleType> _elementTypes{};
    };
}




#endif
